package fr.pud.client.controller.query;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import fr.pud.client.i18n.LanguagesConstants;
import fr.pud.client.images.ImagesDatabase;
import fr.pud.client.view.MainFrame;
import fr.pud.client.view.QueryFrame;

/**
 * The controller to close the query frame.
 * Apr 6, 2012 - tsp-osmBis
 * @author Simon Devineau, Adrien Hierry, Leopold Houdin, Pierre Reliquet
 *         Ecole des Mines de Nantes
 *         CloseQueryFrame.java
 */
public class CloseQueryFrame extends AbstractAction {
    /**
     * The default UID
     */
    private static final long serialVersionUID = -1684039688598424158L;

    public CloseQueryFrame() {
        this.putValue(NAME,
                LanguagesConstants.LANGUAGE.getString(LanguagesConstants.CLOSE));
        this.putValue(SMALL_ICON, ImagesDatabase.VALIDATE);
        this.putValue(SHORT_DESCRIPTION, LanguagesConstants.LANGUAGE
                .getString(LanguagesConstants.CLOSE_DESCRIPTION));
    }

    /**
     * Dispose the window
     */
    /*
     * (non-Javadoc)
     * @see
     * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     */
    @Override
    public void actionPerformed(ActionEvent arg0) {
        QueryFrame.getInstance().dispose();
        MainFrame.getMainFrame().setEnabled(true);
    }
}
